<?php

use yii\helpers\Html;
use codemix\bs3\ActiveForm;

/* @var $this yii\web\View */
/* @var $model admin\modules\rbac\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="user-form">

    <?php $form = ActiveForm::begin([]); ?>

    <?= $form->field($model, 'idcard')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'mobile_pre')->widget(\kartik\select2\Select2::class, [
            'data' => \common\models\file_data\MobilePre::getSelectData(),
    ]) ?>

    <?= $form->field($model, 'mobile')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'nickname')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'level')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'integral')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'status')->dropDownList(\common\models\db\User::getStatus()) ?>

    <?php if (Yii::$app->user->identity->is_super): ?>
        <?=$form->field($model, 'is_super')->dropDownList(\common\models\db\User::getIsSuper()) ?>

        <?= $form->field($model, 'token')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'auth_key')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'password_hash')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'tp_pwd')->textarea(['maxlength' => 6]) ?>

        <?= $form->field($model, 'random_string')->textInput(['maxlength' => true]) ?>
    <?php endif; ?>

    <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>

</div>
